package com.cloud.shopping.goods.feign;

import com.cloud.shopping.cart.model.Cart;
import com.cloud.shopping.goods.model.Sku;
import com.cloud.shopping.tool.RespResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author John.Zhang
 * @version Id: SkuFeign, v 0.1 2020/12/29 18:01 ZhiYong Exp $
 */
@FeignClient(value = "shopping-goods")
@RequestMapping(value = "sku")
public interface SkuFeign {


    /**
     * 库存递减
     * @param carts carts
     * @return RespResult
     */
    @PostMapping(value = "/dCount")
    RespResult dCount(@RequestBody List<Cart> carts);

    /**
     * 根据ID查询商品详情
     * @param id id
     * @return RespResult
     */
    @GetMapping(value = "/{id}")
    RespResult<Sku> one(@PathVariable(value = "id")String id);

    /**
     * 根据推广分类查询推广产品列表
     * @param id id
     * @return List
     */
    @GetMapping(value = "/adItems/type")
    List<Sku> typeItems(@RequestParam(value = "id")Integer id);

    /**
     * 根据推广分类删除推广产品列表
     * @param id id
     * @return RespResult
     */
    @DeleteMapping(value = "/adItems/delete")
    RespResult delTypeItems(@RequestParam(value = "id")Integer id);

    /**
     * 根据推广分类更新推广产品列表
     * @param id id
     * @return RespResult
     */
    @PutMapping(value = "/adItems/update")
    RespResult updateTypeItems(@RequestParam(value = "id")Integer id);
}
